using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
using System.Runtime.Serialization;

// TODO: replace this with the type you want to import.
using Tanks.Contracts;
using TImport = Tanks.Contracts.Map;

namespace TanksGame.ContentPipelines
{


    [ContentImporter(".xml", DisplayName = "Tanks Map Importer")]
    public class TanksContentImporter : ContentImporter<TImport>
    {
        public override TImport Import(string filename, ContentImporterContext context)
        {
            using (Stream s = File.OpenRead(filename))
            {
                return (Map) new DataContractSerializer(typeof(Map)).ReadObject(s);
            }
        }
    }
}
